package eu.testing.system.models;

import java.io.Serializable;
import java.util.List;

import eu.testing.system.models.Question;

public class Test implements Serializable {
	private static final long serialVersionUID = 1L;

	private List<Question> questions;
	private String title;
	private int id;

	public Test() {
		super();

	}

	public Test(List<Question> questions, String title, int id) {
		super();
		this.questions = questions;
		this.title = title;
		this.setId(id);
	}

	public List<Question> getQuestions() {
		return questions;
	}

	public void setQuestions(List<Question> questions) {
		this.questions = questions;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Override
	public String toString() {
		StringBuilder result = new StringBuilder();
		String NEW_LINE = System.getProperty("line.separator");
		result.append(this.getClass().getName() + " Object { " + NEW_LINE);
		result.append(" TEST_ID: " + this.id + NEW_LINE);
		result.append(" TITLE: " + this.title + NEW_LINE);
		result.append(" QUESTIONS: " + this.questions.size() + NEW_LINE);
		for (Question question : this.getQuestions()) {
			System.out.println(question.toString());
			for (Variant variant : question.getVariants()) {
				System.out.println(variant.toString());
			}
		}
		result.append("}");

		return result.toString();
	}

}
